package com.study.mike.common.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.client.codec.Codec;
import org.redisson.codec.JsonJacksonCodec;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Redisson配置类
 *
 * @author kh
 */
@Configuration
public class RedissonConfig {
    @Bean
    public RedissonClient redissonClient() {
        Config config = new Config();
        // redis地址
        config.useSingleServer().setAddress("redis://101.37.80.237:7300");
        // redis密码
        config.useSingleServer().setPassword("sm123");

        // 指定编码
        Codec fastJsonCodec = new JsonJacksonCodec();
        config.setCodec(fastJsonCodec);

        return Redisson.create(config);
    }


}
